﻿using RaptorDB;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TestRaptorDB.src
{
    class Views
    {
    }
    public class SalesInvoiceView : View<SalesInvoice> // create a view for the SalesInvoice type
    {
        public class RowSchema // define the schema for this view
        {
            public string CustomerName; // CustomerName is a normal string index
            public DateTime InvoiceDate;
            public string Address;
            public int Serial;
            public byte Status;
        }
        public SalesInvoiceView()
        {
            this.Name = "SalesInvoice";
            this.Description = "A primary view for SalesInvoices";
            this.isPrimaryList = true;
            this.isActive = true;
            this.BackgroundIndexing = true;
            this.Schema = typeof(SalesInvoiceView.RowSchema);
            this.Mapper = (api, docid, doc) =>
            {

                api.Emit(docid, doc.CustomerName, doc.Date, doc.Address, doc.Serial, doc.Status);
            };
        }
    }
}
